package com.matrix.java.chap_03;

import java.util.Scanner;

/*
    金融：比较成本
 */
public class Ex3_33 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("Enter weight and price for package 1: ");
        double w1 = input.nextDouble();
        double p1 = input.nextDouble();
        System.out.print("Enter weight and price for package 2: ");
        double w2 = input.nextDouble();
        double p2 = input.nextDouble();
        double unitPrice1 = w1/p1;
        double unitPrice2 = w2/p2;
        if (unitPrice1 < unitPrice2) {
            System.out.println("Package 1 has a better price .");
        }else if (unitPrice1 == unitPrice2){
            System.out.println("Two packages have the same price");
        }else {
            System.out.println("Package 2 has a better price .");
        }
        input.close();
    }
}
